Skip to content

fix(error): avoid override errors on rollback#16

Merged
89luca89 merged 1 commit into89luca89:mainfrom
balanza:do-not-shadow-errors
Apr 28, 2026
Merged

fix(error): avoid override errors on rollback#16
89luca89 merged 1 commit into89luca89:mainfrom
balanza:do-not-shadow-errors

Conversation

@balanza
Copy link
Copy Markdown
Contributor

@balanza balanza commented Apr 17, 2026

Redeclare err in the rollback() scope so that it does not override the outer scope.

Example

if err != nil {
	rollback()
	return "", fmt.Errorf("start sidecar: %w", err)
}
# before
level=INFO msg="Error: start sidecar: %!w(<nil>)"

# after
level=INFO msg="Error: start sidecar: exit status 126"

Redeclare `err` in the `rollback()` scope so that it does not override
the outer scope.
@89luca89 89luca89 merged commit 1d727dd into 89luca89:main Apr 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants